<?php

use Jialeo\LaravelSchemaExtend\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddDataTypeToRepaySummaries extends Migration
{
    private $table = 'repay_summaries';

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table($this->table, function (Blueprint $table) {
            $table->unsignedTinyInteger('data_type')->default(1)->comment('新旧卡贷标识: 1: 新卡贷数据, 2:旧卡贷数据')->after('current_repay');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        if(Schema::hasTable($this->table)){
            Schema::table($this->table, function (Blueprint $table) {
                $table->dropColumn('data_type');
            });
        }
    }
}